<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title>采购目录查询</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>

<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">

    <section class="content-header">
        <h1>采购目录查询</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#">交易</a></li>
            <li class="active"><a href="#">采购目录查询</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body" style="margin-top:-10px;">
                <div class="input">
                	<div class="textalign1"><spring:message code="message.lable.yiLiaoJiGouMingCheng"/><spring:message code="message.yanZheng.maoHao"/></div>
                        <div class="boxinput">
                        <input type="text" class="textinput" id="hospName" name="hospName" placeholder="<spring:message code="message.lable.yiLiaoJiGouMingCheng"/>/<spring:message code="message.listForm.pinYinMa"/>" />
                     	</div>
                     
                   <div class="textalign1"><spring:message code="message.listForm.YiLiaoJiGouDiQu"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                       <table style="width:100%;">
                           <tr>
                              <td style="width:33%">
                                <select class="textinput" id="area1" name="area1" disabled="disabled">
                                	<option value="${area.areaId}">${area.areaName}</option>
                                </select>
                              </td>
                              <td style="width:33%">   
                                <select class="textinput" id="area2" name="area2" ></select>
                                </td>
                              <td style="width:33%">
                                <select class="textinput" id="area3" name="area3" ></select>
                              </td>
                           </tr> 
                        </table>
                    </div>
                    	<div class="textalign">是否零差率医院：</div>
	                    <div class="boxinput">
                        <select class="textinput" id="hospClassifyIds" name="hospClassifyIds">
                        	<option value="">请选择</option>
                            <option value="2">是</option>
                            <option value="1">否</option>
                        </select>
                    	</div>
	                 </div>
	                 <div class="input" style="margin-top:3px">
                    	<div class="textalign1"><spring:message code="message.lable.yiLiaoJiGouDengJi"/>：</div>
		                    <div class="boxinput">
		                         <select class="textinput"  id="hospType"  name="hospType"></select>
		                    </div>
	                    
	                      <div class="textalign1">
                        <button type="button" class="btn btn-success btn-sm" onclick="search()"  id="selectDicCompType"><spring:message code="message.button.seachSpacing"/></button>
                	</div>
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
    </section>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
  //绑定回车
    $('#hospName,#hospCode,#hospClassifyIds,#hospType,#area1,#area2,#area3').bind('keydown', function(event) {
        if (event.keyCode == "13") {
            $('#selectDicCompType').click();
        }
    });	
    $("#hospName").focus();//加载页面光标在第一个查询框内
    
    
    
        $(function () {
            $("#gridlist").jqGrid({
                url: "getHospList.html",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
              //  height: 347,
                colNames: [
						   '<spring:message code="message.jqGrid.cz"/>',
                           'hospId',
                           '<spring:message code="message.lable.yiLiaoJiGouBianMa"/>',
                           '<spring:message code="message.lable.yiLiaoJiGouMingCheng"/>',
                           '<spring:message code="message.listForm.YiLiaoJiGouDiQu"/>', 
                           /* '<spring:message code="message.listForm.yiLiaoJiGouFenLei"/>', */
                           '医疗机构属性', 
                           '<spring:message code="message.listForm.yiLiaoJiGouLeiXing"/>',
                           '<spring:message code="message.lable.yiLiaoJiGouDengJi"/>',
                           '<spring:message code="message.listForm.zuZhiJiGouDaiMa"/>'
                           
                           ],
                colModel: [
                     { name: 'opr', width: 20 , align:"center",sortable: false,
                         formatter: function (val, opts, rowdata) {
                             return "<a href='toCatalogByHosp.html?hospId="+rowdata.hospId+"' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -100px 0px' class='opIcon' title='<spring:message code="message.jqGrid.cz.xiangQing"/>'></a>";
                         }       
                     },
                    { name: 'hospId',hidden:true, width: 100 , align:"center" ,sortable: false},     
                    { name: 'hospCode', width: 70 , align:"center",sortable: false,hidden:true },
                    { name: 'hospName', width: 120 , align:"center" ,sortable: false},
                    { name: 'areaName', width: 120 , align:"center" ,sortable: false},
                    /* { name: 'hospClassifyName', width: 80 , align:"center" ,sortable: false}, */
                    { name: 'hospClassifyId', width: 70 , align:"center" ,sortable: false,
                    	formatter : function(val, opts, rowdata) {
                            var strSta = "";
                            if(rowdata.hospClassifyId == 1){
                                strSta += "县级及县级以上医院";
                            }else if(rowdata.hospClassifyId == 2){
                                strSta += "基层医院";
                            }
                            return strSta;
                        }},
                    { name: 'hospTypeName', width: 80 , align:"center" ,sortable: false},
                    { name: 'hospLevelName', width: 80 , align:"center" ,sortable: false},
                    { name: 'orgCode', width: 90 , align:"center",sortable: false }
                
                ],
                rowNum: 20,
                rowList: [10, 20, 50,100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                gridComplete:function(){
                	//序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                	//数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                },
                caption: "采购目录列表",
                jsonReader: {
                    repeatitems: false,
                    id: "hospId"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
			$("#gridlist").jqGrid("setGridHeight", create());
        });
        
        
        function search(page) {
            var hospCode = $.trim($("#hospCode").val());
            var hospName = $.trim($("#hospName").val());
            var hospClassifyIds = $.trim($("#hospClassifyIds").val());
            var hospType = $.trim($("#hospType").val());
            var area1 = $.trim($("#area1").val());
            var area2 = $.trim($("#area2").val());
            var area3 = $.trim($("#area3").val());
            $("#gridlist").jqGrid("clearGridData");
                $("#gridlist").jqGrid('setGridParam',{  
                mtype: "POST",
                datatype:'json',
                postData:{"hospCode":hospCode, "hospName":hospName,"hospClassifyIds":hospClassifyIds,"hospType":hospType,"area1":area1,"area2":area2,"area3":area3},
                page : (page || 1)
            }).trigger("reloadGrid"); //重新载入  
        }
        
        $("#hospType").HNSelect({ 
            url: "${ctx}/selectController/getDicSys.html", 
            data: { 'ID' : "002" },
            defaultText: "<option value=''><spring:message code="message.select.option"/></option>",
            defaultselect: "",
        });
        $("#area2").HNSelect({
            parent_selector: "#area1",  url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID",defaultText: "<option value=''><spring:message code="message.select.option"/></option>",
            func: function () {
                $("#area3").HNSelect({
                    parent_selector: "#area2", url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID", defaultText: "<option value=''><spring:message code="message.select.option"/></option>",
                });
            }
        });
        
    </script>
</body>
</html>